<?php
class Advertisement_Model extends ORM {
	
	
	protected $table_name = 'advertisement';
	protected $primary_key = 'adv_id';
	protected $col_name = 'adv_name';
	protected $col_url = 'adv_url';
	protected $col_image = 'adv_image';
	protected $col_begin_date = 'adv_begin_date';
	protected $col_expired_date = 'adv_expired_date';
	protected $col_position = 'adv_position';
	protected $col_open = 'adv_open';
	protected $col_sort_order = 'adv_order';
	protected $col_status = 'adv_status';
	public function get()
	{
		$this->db->from($this->table_name);
		$this->db->select('*');
		$this->db->orderby($this->col_sort_order,'desc');
		$this->db->orderby($this->primary_key,'desc');
		$query = $this->db->get();
		//echo $this->db->last_query();
		//if($query->count() > 0)
			return $query->result_array(false);
	}
	
	public function get_with_active()
	{
		$this->db->where($this->col_status,'1');
		$this->db->orderby($this->col_sort_order,'desc');
		return $this->get();
	}
}
?>

